//
//  CYYiHuiDaTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/2/1.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYYiHuiDaTableViewCell.h"

@implementation CYYiHuiDaTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImageView.layer.cornerRadius = self.headImageView.frame.size.height / 2;
    self.headImageView.layer.masksToBounds = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapHeadImageView:)];
    [self.headImageView addGestureRecognizer:tap];
    self.headImageView.userInteractionEnabled = YES;
}

- (void)tapHeadImageView:(UITapGestureRecognizer *)tap{
    CYGeRenZhuYeViewController *zhuye = [[CYGeRenZhuYeViewController alloc] init];
    if (self.model.user_id) {
        zhuye.userId = self.model.user_id;
    }else{
        zhuye.userId = self.model.userId;
    }
    [[AppDelegate sharedAppDelegate] pushViewController:zhuye];
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];

    self.niaknameLabel.text = model.nickname;
    self.timeLabel.text = model.createTime;
    self.titleLabel.text = model.title;
    self.huifuLabel.text = [[Tool sharedInstance] delHTMLBiqoQianWithHtml:model.content];
    if ([model.status integerValue] == 1) {
        //status = 1 不展示remark
    }else{
        self.shenheLabel.text = model.remark;
    }
}

- (NSAttributedString *)strToAttriWithStr:(NSString *)htmlStr{
    return [[NSAttributedString alloc] initWithData:[htmlStr dataUsingEncoding:NSUnicodeStringEncoding]
                                            options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType}
                                 documentAttributes:nil
                                              error:nil];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
